import java.util.Scanner;

public class 空心正方形 {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入边长：");
        int a= scanner.nextInt();
        int line=a;
        for (int i = 0; i < line; i++) {
            if (i > 0 && i < line-1){    //中间空的情况
                for (int j = 0; j < line; j++) {
                    if (j == 0 | j == line-1){
                        System.out.print("* ");
                    }else if (j <= line-1) {
                        System.out.print("  ");
                    }
                }
            }else if (i == 0 | i == line-1) {
                for (int k = 0; k < line; k++){
                    System.out.print("* ");
                }
            }
            System.out.println("  ");
        }
    }
}
